<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <h2 v-draggable>使用全局过滤器</h2>
    <!-- 使用全局过滤器 -->
    <h1>{{ num | addZero }}</h1>
    <h2>使用全局自定义指令 v-focus</h2>
    <div style="margin-top:20px">
      <el-button v-copy="copyText">v-copy指令实现一键复制</el-button>
    </div>
    <div style="margin-top:20px">
      <el-button v-longpress="longpress">v-longpress指令长按</el-button>
    </div>
    <div style="margin-top:20px">
      <el-button v-debounce="debounceClick">防抖</el-button>
    </div>
    <div style="margin-top:20px">
      <el-button v-permission="'1'">权限按钮1</el-button>
      <el-button v-permission="'10'">权限按钮2</el-button>
    </div>
    <!-- 使用全局自定义指令 -->
    <el-input v-model="val" v-focus v-emoji></el-input>
  </div>
</template>

<script>
export default {
  name: "HelloWorld",
  props: {
    msg: String,
    num: Number,
  },
  data() {
    return {
      val: "",
      copyText: "一键复制指令",
    };
  },
  methods: {
    debounceClick(){
      console.log('只触发一次');
    },
    longpress() {
      alert("长按指令生效");
    },
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
